﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace InternetMonitoringServer
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            
        }

        private void btn_startserver_Click(object sender, EventArgs e)
        {
            btn_startserver.Enabled = false;
            btn_stopserver.Enabled = true;

            Server.StartServer();
            rtb_log.Text = Server.log+"\n";
            timer1.Start();
        }

        private void btn_stopserver_Click(object sender, EventArgs e)
        {
            btn_startserver.Enabled = true;
            btn_stopserver.Enabled = false;

            Server.StopServer();
            rtb_log.Text = Server.log + "\n";
            timer1.Stop();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            rtb_log.Text = Server.log + "\n";
            rtb_log.SelectionStart = rtb_log.Text.Length;
            rtb_log.ScrollToCaret();
        }

        private void btnClearLog_Click(object sender, EventArgs e)
        {
            Server.log = string.Empty;
            rtb_log.Clear();
        }
    }


}
